<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>起租提醒</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
            <form id="searchBar">
                <div class="fieldset1 clearFix">
                	
                    <div class="formBtns notRight">
                    	<span id="toStartRent" class="sq-button sq-button-round" onclick="toStartRent()">拨打电话</span>
                        <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    </div>
                </div>
            </form>
            
        </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null,form=null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/risk/rskCommRec/initList.do?cstId=${cstId}&buTypCd=4',
            method: 'get',
            columns: [
                      {display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: false},
                      {display: '所属机构', name: 'buOrgCdNm', width: 130, align: 'left', enabledSort: false},
                      {display: '提醒时间', name: 'collectTm', width: 80, align: 'left', enabledSort: false,render:renderDate},
                      {display: '外呼时长（秒）', name: 'commSec', width: 80, align: 'center', enabledSort: false},
                      {display: '提醒方式', name: 'collectWayCdNm', width: 80, align: 'center', enabledSort: false},
                      {display: '任务人', name: 'collectUsrNm', width: 80, align: 'left', enabledSort: false},
                      {display: '联系人', name: 'lkMan', width: 70, align: 'left', enabledSort: false},
                      {display: '联系电话', name: 'lkPhone', width: 90, align: 'center', enabledSort: false},
                      {display: '沟通记录', name: 'collectRem', minWidth: 100, align: 'left', enabledSort: false,
                          render:function(rowdata,index,value){
                              return '<span class="gridTip" style="cursor: pointer;" title="'+ rowdata.collectRem +'">'+rowdata.collectRem+'</span>';
                          }
                      }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: true,
            enabledEdit: true,
        });
        grid.setHeight(100);

        //事业部
        $("#buOrgCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        $("#collectWayCd").ligerComboBox({
            valueField: 'key',
            textField: 'value'
        });
        $("#pageloading").hide();
        var callback = function () {
            grid.reload();
        };

        /* 导出 */
        $("#expXlsBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            var req="buTypCd=1";
            for (name in data) {
                for (name in data) {
                    if(data[name]){
                        req=req+"&"+name+"="+data[name];
                    }
                }
            }
            var wait_dialog;
            
        });
        /* 查询 */
        $("#searchBtn").click(function (event) {
            
            grid.reload();
        });

    });

    /* 拨打起租提醒电话*/
    function toStartRent(){
    	var wait_dialog;
    	//var data = {"cstId":${cstId},"paySchId":${paySchId}};
        $.ajax({
            type: 'post',
            dataType:'json',
            url: '<%=path%>/risk/rskCommRec/toStartRent.do?cstId=${cstId}&paySchId=${paySchId}',
            //data:data,
            beforeSend:function(){
                wait_dialog=$.ligerDialog.SQalert({content: '正在外呼...',SQ_type: "waitting"});
            },
            success:function(msg){
                wait_dialog.close();
                if(msg.success == 1){
                	 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                    grid.reload();
                }else{
                    $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            },
            error:function(e){
            	$.ligerDialog.SQalert({content:"系统错误请稍后再试", SQ_type: "error"});
            }
        });
    }
    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>

</body>
</html>
